import { Injectable } from '@angular/core';
import { LoggerService } from './logger.service';

@Injectable({
  providedIn: 'root'
})
export class ProductService {

  GetProducts(): Product[] {
    var prods = [];
    for (var i = 0; i < 20; i++) {
      prods.push(new Product(i + 1, `iphone8 v${i}`, `iphone8 v${i}最新款`, 200 * i + 2000, "http://placehold.it/320X150", 0.5 * i + 1.5));
    }
    this._logger.Log(`获取商品${prods.length}个`);
    return prods;
  }
  constructor(public _logger: LoggerService) { }
}
export class Product {
  constructor(public id: number,
    public prodTitle: string,
    public prodDesc:string,
    public prodPrice: number,
    public prodImg: string,
    public prodStars: number) {

  }
}
